home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / chkvend.pas < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  3KB  |  105 lines

  1. program chkvend;
  2. {$I-}
  3.  
  4. { Testprogram checking all nodes on all attached servers and
  5.   showing the manifacturers of the corresponding ethernet cards. }
  6.  
  7. uses nwMisc,nwConn,nwServ;
  8.  
  9. var PleaseMail:Boolean;
  10.     Path      :string;
  11.  
  12.     StationNbr    : byte;
  13.     StationAddress: TinternetworkAddress;
  14.     Sinfo         : TFileServerInformation;
  15.     t,conn        : byte;
  16.  
  17.     ObjName  :string;
  18.     objType  :word;
  19.     ObjId    :Longint;
  20.     LoginTime:TnovTime;
  21.  
  22.     s,ts,subs:string;
  23.     f        :text;
  24.     fnd      :boolean;
  25.     p        :byte;
  26. begin
  27. PleaseMail:=False;
  28.  
  29. Path:=ParamStr(0);
  30. while NOT (path[ord(path[0])] IN [':','\','/']) do dec(Path[0]);
  31. {Path now holds the name of the path where the chkvend.exe file is located }
  32.  
  33. assign(f,Path+'VEND_XXX.');
  34. reset(f);
  35. IF IOresult<>0
  36.  then begin
  37.       writeln('Couldn''t open VEND_XXX');
  38.       writeln('<CHKVEND expects the file to in the same directory as the executable>');
  39.       halt(1);
  40.       end;
  41.  
  42. { Check all 8 possible server attchments }
  43. For conn:=1 to 8
  44.  do begin
  45.     SetPreferredConnectionId(conn);
  46.     If IsConnectionIdInUse(conn)
  47.      then begin
  48.           GetFileServerInformation(Sinfo); { Get maximum number of conections }
  49.           for t:=1 to Sinfo.ConnectionsMax
  50.           do begin
  51.              { check all connections }
  52.              IF GetInternetAddress(t,StationAddress)
  53.               then begin
  54.                    GetConnectionInformation(t,objName,objType,ObjId,LoginTime);
  55.                    objname:=objName+'                   ';
  56.                    objName[0]:=#16;
  57.                    ts:=HexDumpStr(StationAddress.node,12);
  58.                    { check file if vendor's code known }
  59.                    fnd:=False;
  60.                    reset(f);
  61.                    REPEAT
  62.                    readln(f,s);
  63.                    p:=pos('#',s);
  64.                    if p>0 then s[0]:=chr(p-1);
  65.                    p:=pos(' ',s);
  66.                    if p=0
  67.                     then suBs:=''
  68.                     else begin
  69.                          subS:=copy(s,1,p-1);
  70.                          if pos(subs,ts)=1
  71.                           then begin
  72.                                fnd:=true;
  73.                                writeln(ts,' ',objName,' -',s);
  74.                                end;
  75.                          end;
  76.  
  77.                    UNTIL eof(f) or fnd;
  78.  
  79.                    if (NOT fnd)
  80.                     then begin
  81.                          PleaseMail:=true;
  82.                          writeln(ts,' ',objname,' -????');
  83.                          end;
  84.  
  85.                    end;
  86.              end;
  87.           end;
  88.     end;
  89.  
  90. IF PleaseMail
  91.  then begin
  92.       writeln;
  93.       writeln('A number of unknown Vendor codes have been found.');
  94.       writeln('If you know the vendor(s) of the Ethernet cards in question,');
  95.       writeln('you can update the VEND_XXX. file with a text editor.');
  96.       writeln;
  97.       writeln('You are also kindly requested to mail the information to us.');
  98.       writeln('Fido    : 2:512/250.4064 or 2:2426/4030.13');
  99.       writeln('InterNet: Rene.Spronk@p4064.f250.n512.z2.fidonet.org');
  100.       writeln;
  101.       end;
  102.  
  103. SetPreferredConnectionId(0);
  104. close(f);
  105. end.